package com.lqq.eduservice.controller.fron;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lqq.commonutils.R;
import com.lqq.eduservice.entity.EduCourse;
import com.lqq.eduservice.entity.EduTeacher;
import com.lqq.eduservice.service.EduCourseService;
import com.lqq.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
//@CrossOrigin
@RequestMapping("/eduservice/indexfront")
public class IndexFrontController {

    @Autowired
    private EduCourseService courseService;

    @Autowired
    private EduTeacherService teacherService;
    @GetMapping("/index")
    public R index() {
        List<EduCourse> courseList = courseService.getIndexCourse();
        List<EduTeacher> teacherList = teacherService.getIndexTeacher();
        return R.ok().data("courseList", courseList)
                     .data("teacherList", teacherList);
    }
}
